import 'package:flutter/material.dart';
import 'package:xws/utils/theme_util.dart';

/// 标签
class AppLabel extends StatelessWidget {
  const AppLabel({
    Key? key,
    this.content,
    this.color,
    this.textColor,
    this.fontSize,
    this.fontHeight,
    this.radius = 3,
    this.padding,
    this.margin,
    this.fontWeight,
    this.alignment = Alignment.center,
    this.height,
  }) : super(key: key);

  final String? content;
  final Color? color;
  final Color? textColor;
  final double? fontSize;
  final double? fontHeight;
  final double radius;
  final EdgeInsetsGeometry? padding;
  final EdgeInsetsGeometry? margin;
  final FontWeight? fontWeight;
  final AlignmentGeometry? alignment;
  final double? height;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: height,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Text(
            content ?? '',
            style: TextStyle(
              color: textColor ?? white(context),
              fontSize: fontSize ?? 10,
              height: fontHeight ?? 1.15,
              fontWeight: fontWeight,
            ),
          ),
        ],
      ),
      padding: padding ?? const EdgeInsets.symmetric(horizontal: 4, vertical: 3),
      margin: margin,
      alignment: alignment,
      decoration: BoxDecoration(
        color: color ?? theme(context),
        borderRadius: BorderRadius.circular(radius),
      ),
    );
  }
}
